package br.com.montezuma.empresarial.models;


import java.util.ArrayList;  
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column; 
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import br.com.caelum.vraptor.Resource;


/**
 * <pre>
 * @author : Vitor Barroso
 * Purpose :  Representation of Contato.
 * Amendment History                                                                
 * Date - Name - Description                              
 * 27/05/2012 - Vitor Barroso - initial version.
 * 
 * Copyright 2012 Montezuma Software
 * </pre>
 */
@Resource
@Entity
public class Contato implements IListagem{
	@Id
	@GeneratedValue
	private Long id;
	@Column(length=100,nullable=false)
	private String nome;
	@Column(length=20,nullable=false)
	private String cpf;
	@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
	@JoinColumn(name="cargo_id", referencedColumnName="id")
	private Cargo cargo;
	@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
	@JoinColumn(name="empresa_id", referencedColumnName="id")
	private Empresa empresa;
	@Column(length=50,nullable=false)
	private String email;
	@Column(length=15,nullable=false)
	private String telefone;
	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}
	/**
	 * @return the nome
	 */
	public String getNome() {
		return nome;
	}
	/**
	 * @param nome the nome to set
	 */
	public void setNome(String nome) {
		this.nome = nome;
	}
	/**
	 * @return the cpf
	 */
	public String getCpf() {
		return cpf;
	}
	/**
	 * @param cpf the cpf to set
	 */
	public void setCpf(String cpf) {
		this.cpf = cpf;
	}
	/**
	 * @return the cargo
	 */
	public Cargo getCargo() {
		return cargo;
	}
	/**
	 * @param cargo the cargo to set
	 */
	public void setCargo(Cargo cargo) {
		this.cargo = cargo;
	}
	/**
	 * @return the empresa
	 */
	public Empresa getEmpresa() {
		return empresa;
	}
	/**
	 * @param empresa the empresa to set
	 */
	public void setEmpresa(Empresa empresa) {
		this.empresa = empresa;
	}
	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}
	/**
	 * @param email the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}
	/**
	 * @return the telefone
	 */
	public String getTelefone() {
		return telefone;
	}
	/**
	 * @param telefone the telefone to set
	 */
	public void setTelefone(String telefone) {
		this.telefone = telefone;
	}
	
	
	
public List<String> getColumns() {
		
		List <String> columns = new ArrayList<String>();
		columns.add("Id");
		columns.add("Nome");
		columns.add("CPF");
		
		return columns;
	}
	
	
	public List<String> getValues() {
		
		List <String> columns = new ArrayList<String>();
		columns.add(String.valueOf(this.getId()));
		columns.add(String.valueOf(this.getNome()));
		columns.add(String.valueOf(this.getCpf()));
		
		return columns;
	}
	
	
	public String getIdColumnName() {
		
		return "id";
	}
	
	public String getIdValue() {
		
		return String.valueOf(this.id);
	}

	
	public List<Class> getColumnsClass() {
		
		List <Class> columns = new ArrayList<Class>();
		columns.add(Long.class);
		columns.add(String.class);
		columns.add(String.class);
		
		return columns;
	}	
}